package com.huilian.cloud.module.test.order.controller;

import com.huilian.cloud.framework.common.pojo.CommonResult;
import com.huilian.cloud.module.test.order.entity.Order;
import com.huilian.cloud.module.test.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 假设订单支付成功发送订单的MQ消息，库存收到消息则将锁定库存改为已售库存
     * @param order
     * @return
     */
    @RequestMapping("/sendOrder")
    public CommonResult<Boolean> sendOrder(@RequestBody Order order){
        orderService.sendOrder(order) ;
        return CommonResult.success(true) ;
    }
}
